Hello everyone,
In this blog, I'll guide you through a challenge I encountered, focused on exploiting a
Broadcast Receiver vulnerability. The challenge comes from a platform called MobileHackingLabs,
which is excellent for honing your mobile pentesting skills. Let’s dive in!
After opening the app. You will get an interface like this,
Upon launching the application, you are presented with two options: Login or Sign Up. Choose
"Sign Up" to create a new user account. After logging in with your new credentials, you'll see
two buttons: "Setup" and "Master Switch." Clicking on the "Setup" button displays several
devices that can be turned on or off. However, certain devices, like the A/C and Speaker, cannot
be activated since you are logged in as a guest user.
When you click on the "Master Switch," you're prompted to enter a 3-digit PIN. This button
allows you to activate all devices with a single click, but it's only accessible to users with a
privileged account.
Further analysis using the Text Search feature in JADX revealed a class named `CommunicationManager` when searching for `MasterReceiver`.
Inside the `onReceive` method, the code first checks if the
action of the received intent matches the string `"MASTER_ON"`.
If this condition is met, it proceeds to extract an integer extra from the intent using the key
`"key"`. If the `context2`
parameter is not null and the extracted key passes the `check_key` method from the `Checker` class (indicating a valid PIN), the `turnOnAllDevices` method from the `CommunicationManager` is invoked to turn on all connected
devices. A toast message is then displayed, stating *"All devices
are turned on."* However, if the `check_key` method
returns false (indicating an incorrect PIN), a different toast message appears, saying *"Wrong PIN!!"*.
Copy this code, create a python file and paste this.
Make sure you have the required pycryptodome library installed. You can install it using pip:
└─$ pip install pycryptodome
Next, open the terminal and run the following `adb` command using the correct PIN that was just
brute-forced.
You should see a message indicating "ALL Devices are Turned On".
After that, click on the Setup button and check that all devices are activated.